﻿<AspNetMembershipManager:EditDialogWindow x:Class="AspNetMembershipManager.User.Profile.ProfilePropertyWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="User profile property" Height="379" Width="625"
		xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
		xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:Profile="clr-namespace:AspNetMembershipManager.User.Profile"
        xmlns:AspNetMembershipManager="clr-namespace:AspNetMembershipManager"
        d:DataContext="{d:DesignInstance Profile:PropertyViewModel}" 
		mc:Ignorable="d" 
		d:DesignHeight="322" d:DesignWidth="668"
		MinWidth="500">
	<Window.CommandBindings>
		<CommandBinding Command="Save" CanExecute="Ok_CanExecute" Executed="Ok_Executed" />
	</Window.CommandBindings>
    <Grid>
		<GroupBox Header="Profile property value" Margin="5,5,5,78">
			<Grid>
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="Auto" />
					<ColumnDefinition Width="*" />
				</Grid.ColumnDefinitions>
				<Grid.RowDefinitions>
					<RowDefinition Height="auto" />
					<RowDefinition Height="auto" />
                    <RowDefinition Height="auto" />
				</Grid.RowDefinitions>
				<Label Content="Name:" Grid.Column="0" Grid.Row="0" />
				<Label Content="Type:" Grid.Column="0" Grid.Row="1" />
				<TextBox Text="{Binding Name, Mode=OneWay}" IsReadOnly="True" Grid.Column="1" Grid.Row="0" />
				<TextBox Text="{Binding Type, Mode=OneWay}" IsReadOnly="True" Grid.Column="1" Grid.Row="1" />

                <DataGrid ItemsSource="{Binding Properties}" Margin="6" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2">
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="Property name" Binding="{Binding Name}" IsReadOnly="True" />
                        <DataGridTextColumn Header="Property type" Binding="{Binding Type}" IsReadOnly="True" />
                        <!--<DataGridTemplateColumn Header="Property value">
                            <DataGridTemplateColumn.CellTemplateSelector>
                                <vm:ProfilePropertyTemplateSelector>
                                    <vm:ProfilePropertyTemplateSelector.BooleanTemplate>
                                        <DataTemplate>
                                            <CheckBox IsChecked="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                                        </DataTemplate>
                                    </vm:ProfilePropertyTemplateSelector.BooleanTemplate>
                                    <vm:ProfilePropertyTemplateSelector.StringTemplate>
                                        <DataTemplate>
                                            <TextBox Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                                        </DataTemplate>
                                    </vm:ProfilePropertyTemplateSelector.StringTemplate>
                                    <vm:ProfilePropertyTemplateSelector.NumberTemplate>
                                        <DataTemplate>
                                            <TextBox Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                                        </DataTemplate>
                                    </vm:ProfilePropertyTemplateSelector.NumberTemplate>
                                    <vm:ProfilePropertyTemplateSelector.ObjectTemplate>
                                        <DataTemplate>
                                            <Button Content="..." Click="CustomProfilePropertyEdit" />
                                        </DataTemplate>
                                    </vm:ProfilePropertyTemplateSelector.ObjectTemplate>
                                </vm:ProfilePropertyTemplateSelector>
                            </DataGridTemplateColumn.CellTemplateSelector>
                        </DataGridTemplateColumn>-->
                    </DataGrid.Columns>
                </DataGrid>
            </Grid>
        </GroupBox>
		<Label Content="{Binding Error}" Style="{StaticResource ErrorMessage}" HorizontalAlignment="Left" Margin="5,0,0,62" VerticalAlignment="Bottom" Height="10" />
		<Button Content="Ok" IsDefault="True" HorizontalAlignment="Right" Margin="0,0,12,12" VerticalAlignment="Bottom" Width="75" Command="Save" />
		<Button Content="Cancel" IsCancel="True" HorizontalAlignment="Right" Margin="0,0,92,12" VerticalAlignment="Bottom" Width="75" />
	</Grid>
</AspNetMembershipManager:EditDialogWindow>
